﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GTR.News.AdminModel;
using System.Data;

namespace GTR.News.AdminDAL
{
    public class NewsDAL
    {

        /// <summary>
        /// 新闻显示
        /// </summary>
        /// <returns></returns>
        public DataTable Newsxian()
        {
            string str = "select NewsID,Title,NewsDate,Content,NewsTypeID from News";
            return DBhelper.GetTable(str);
        }
       /// <summary>
       /// 新闻删除
       /// </summary>
       /// <param name="id"></param>
       /// <returns></returns>
        public int Newsdelete(int id)
        {
            return DBhelper.NonQuery("delete from News where NewsID=" + id);
        }
        /// <summary>
        /// 添加新闻
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public int newADD(GTR.News.AdminModel.News n)
        {
            string st = string.Format("insert INTO News VALUE('{0}','{1}','{2}',{3})", n.Title, n.NewsDate, n.Content, n.NewsTypeID);
            return DBhelper.NonQuery(st);
        }




    }
}
